//过滤侧边栏数据或者路由数据的方法
//curRole:当前登录人的身份信息
export const filterMenusOrRoutes = (arr: any, curRole: string) => {
    return arr.filter((item: any) => !item.roles || item.roles.includes(curRole))
    .map((item:any)=>{
        const o = {
            ...item,
        }
        if(item.children){//如果有children，则对children做同样的处理
            o.children = filterMenusOrRoutes(item.children,curRole);
        }
        return o;
    })
}